Skip to content

Breaking: Rename consistent-output rule to require-test-output #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

bmish
Copy link
Member

@bmish bmish commented Jun 26, 2021

Changes the default rule behavior to always require a test output assertion. The old default behavior of consistent (only require output assertions if some tests have it) is still provided as an available option.

  • As of ESLint 7, the output property is required for test cases that provide an autofix
  • And even when test cases don't autofix, it's still best practice to assert that there's no autofix with output: null

Part of v4 release (#120).

@bmish bmish mentioned this pull request Jun 26, 2021
20 tasks
@bmish bmish force-pushed the require-test-output branch from 9e4c37a to 46f9918 Compare June 26, 2021 15:38
@bmish bmish force-pushed the require-test-output branch from 46f9918 to 50d4b17 Compare July 13, 2021 04:00
Changes the default rule behavior to always require a test `output` assertion. The old default  behavior of `consistent` (only require `output` assertions if some tests have it) is still provided as an available option.

* [As of ESLint 7](https://eslint.org/docs/user-guide/migrating-to-7.0.0#additional-validation-added-to-the-ruletester-class), the `output` property is required for test cases that provide an autofix
* And even when test cases don't autofix, it's still best practice to assert that there's no autofix with `output: null`
@bmish bmish force-pushed the require-test-output branch from 50d4b17 to 4ea8bff Compare July 13, 2021 04:02
@bmish
Copy link
Member Author

bmish commented Jul 22, 2021

I've reconsidered this change and I don't think it's necessary anymore since ESLint 7 now enforces that the output is asserted when a test case has an autofix. That should be enough to ensure autofixing is tested, while not requiring that every test case has an output assertion for non-autofixable rules.

@bmish bmish closed this Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant